#!/usr/bin/env node

const log = console.log;

let buf1 = Buffer.alloc(256);
buf1[0]  = 0;

log('buf1 length:', buf1.length);
log('\nbuf1:', buf1);

for(let i=0; i<buf1.length; i++) buf1[i] = i;
log('\nbuf1:', buf1);

let buf2 = buf1.slice(246, 256);
log('\nbuf2:', buf2);
log('\nbuf2 length:', buf2.length);

buf2.fill(0);
log('\nbuf2:', buf2);

let array = ['a', 34, 'hello', 0xba, 0xdf, 0x00, 255, 10];
let buf3  = Buffer.from(array);

log('\nbuf3:', buf3);
log('\nbuf3 length:', buf3.length);

let buf4 = Buffer.from('hello world', 'utf8');
log('\nbuf4:', buf4);
log('\nbuf4 length:',buf4.length);

buf4.copy(buf3,0,0,buf4.length);
log('\nbuf3:', buf3);
log('\nbuf3 length:',buf3.length);
